home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / technical documentation / macintosh technotes and q&as / technotes / tn / dtpnotification.h.sit.hqx / DTPNotification.h
Encoding:
Text File  |  1997-05-12  |  6.0 KB  |  176 lines

  1. //----------------------------------------------------------------------------------------------
  2. // AsynchErrorNotificationUPP
  3. //----------------------------------------------------------------------------------------------
  4. typedef pascal void (*AsynchErrorNotificationProcPtr) (StringHandle string);
  5.  
  6. #if GENERATINGCFM
  7. typedef UniversalProcPtr AsynchErrorNotificationUPP;
  8. #else
  9. typedef AsynchErrorNotificationProcPtr AsynchErrorNotificationUPP;
  10. #endif
  11.  
  12. enum
  13. {
  14.     uppAsynchErrorNotificationProcInfo = kPascalStackBased
  15.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(StringHandle)))
  16. };
  17.  
  18. #if GENERATINGCFM
  19. #define NewAsynchErrorNotificationProc(userRoutine)        \
  20.         (AsynchErrorNotificationUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppAsynchErrorNotificationProcInfo, GetCurrentISA())
  21. #else
  22. #define NewAsynchErrorNotificationProc(userRoutine)        \
  23.         (AsynchErrorNotificationUPP)(userRoutine)
  24. #endif
  25.  
  26. #if GENERATINGCFM
  27. #define CallAsynchErrorNotificationProc(userRoutine, notifyStringHdle)        \
  28.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppAsynchErrorNotificationProcInfo, (notifyStringHdle))
  29. #else
  30. #define CallAsynchErrorNotificationProc(userRoutine, notifyStringHdle)        \
  31.         (*(userRoutine))((notifyStringHdle))
  32. #endif
  33.  
  34. //----------------------------------------------------------------------------------------------
  35. // EndNotificationUPP
  36. //----------------------------------------------------------------------------------------------
  37. typedef pascal void (*EndNotificationProcPtr) ();
  38.  
  39. #if GENERATINGCFM
  40. typedef UniversalProcPtr EndNotificationUPP;
  41. #else
  42. typedef EndNotificationProcPtr EndNotificationUPP;
  43. #endif
  44.  
  45. enum
  46. {
  47.     uppEndNotificationProcInfo = kPascalStackBased
  48. };
  49.  
  50. #if GENERATINGCFM
  51. #define NewEndNotificationProc(userRoutine)        \
  52.         (EndNotificationUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppEndNotificationProcInfo, GetCurrentISA())
  53. #else
  54. #define NewEndNotificationProc(userRoutine)        \
  55.         (EndNotificationUPP)(userRoutine)
  56. #endif
  57.  
  58. #if GENERATINGCFM
  59. #define CallEndNotificationProc(userRoutine)        \
  60.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppEndNotificationProcInfo)
  61. #else
  62. #define CallEndNotificationProc(userRoutine)        \
  63.         (*(userRoutine))()
  64. #endif
  65.  
  66. //----------------------------------------------------------------------------------------------
  67. // InForegroundUPP
  68. //----------------------------------------------------------------------------------------------
  69. typedef pascal Boolean (*InForegroundProcPtr) ();
  70.  
  71. #if GENERATINGCFM
  72. typedef UniversalProcPtr InForegroundUPP;
  73. #else
  74. typedef InForegroundProcPtr InForegroundUPP;
  75. #endif
  76.  
  77. enum
  78. {
  79.     uppInForegroundProcInfo = kPascalStackBased
  80.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  81. };
  82.  
  83. #if GENERATINGCFM
  84. #define NewInForegroundProc(userRoutine)        \
  85.         (InForegroundUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppInForegroundProcInfo, GetCurrentISA())
  86. #else
  87. #define NewInForegroundProc(userRoutine)        \
  88.         (InForegroundUPP)(userRoutine)
  89. #endif
  90.  
  91. #if GENERATINGCFM
  92. #define CallInForegroundProc(userRoutine)        \
  93.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppInForegroundProcInfo)
  94. #else
  95. #define CallInForegroundProc(userRoutine)        \
  96.         (*(userRoutine))()
  97. #endif
  98.  
  99. //----------------------------------------------------------------------------------------------
  100. // StatusMessageUPP
  101. //----------------------------------------------------------------------------------------------
  102. typedef pascal void (*StatusMessageProcPtr) (StringHandle string);
  103.  
  104. #if GENERATINGCFM
  105. typedef UniversalProcPtr StatusMessageUPP;
  106. #else
  107. typedef StatusMessageProcPtr StatusMessageUPP;
  108. #endif
  109.  
  110. enum
  111. {
  112.     uppStatusMessageProcInfo = kPascalStackBased
  113.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(StringHandle)))
  114. };
  115.  
  116. #if GENERATINGCFM
  117. #define NewStatusMessageProc(userRoutine)        \
  118.         (StatusMessageUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppStatusMessageProcInfo, GetCurrentISA())
  119. #else
  120. #define NewStatusMessageProc(userRoutine)        \
  121.         (StatusMessageUPP)(userRoutine)
  122. #endif
  123.  
  124. #if GENERATINGCFM
  125. #define CallStatusMessageProc(userRoutine, statusStringHdle)        \
  126.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppStatusMessageProcInfo, (notifyStringHdle))
  127. #else
  128. #define CallStatusMessageProc(userRoutine, statusStringHdle)        \
  129.         (*(userRoutine))((notifyStringHdle))
  130. #endif
  131.  
  132. #if defined(powerc) || defined (__powerc)
  133. #pragma options align=mac68k
  134. #endif
  135.  
  136. //----------------------------------------------------------------------------------------------
  137. // TOldPrintMonitorPrintingData:
  138. // for classic background printing and desktop printing that does not support third-party drivers 
  139. //----------------------------------------------------------------------------------------------
  140. typedef struct
  141. {
  142.     short                        iOpCode;
  143.     short                        iError;
  144.     long                        iReserved;
  145.     THPrint                        hPrint;
  146.     short                        noProcs;
  147.     long                        iReserved2;
  148.     AsynchErrorNotificationUPP    pASyncNotificationProc;    //UPP to put up a notification
  149.     EndNotificationUPP            pASyncEndnotifyProc;    //UPP to take down the notification
  150.     InForegroundUPP                pInForegroundProc;        //UPP to check if we are is in foreground
  151. } TOldPrintMonitorPrintingData;
  152.  
  153. //----------------------------------------------------------------------------------------------
  154. // TDesktopPrintingData:
  155. // for Desktop Printing that supports third-party drivers
  156. //----------------------------------------------------------------------------------------------
  157. typedef struct
  158. {
  159.     short                        iOpCode;
  160.     short                        iError;
  161.     long                        iReserved;
  162.     THPrint                        hPrint;
  163.     short                        noProcs;
  164.     long                        iReserved2;
  165.     AsynchErrorNotificationUPP    pASyncNotificationProc;    //UPP to put up a notification
  166.     EndNotificationUPP            pASyncEndnotifyProc;    //UPP to take down the notification
  167.     InForegroundUPP                pInForegroundProc;        //UPP to check if we are is in foreground
  168.     StatusMessageUPP            pStatusMessageProc;        //UPP to update the status message in the desktop printer window
  169. } TDesktopPrintingData;
  170.  
  171. //----------------------------------------------------------------------------------------------
  172. //----------------------------------------------------------------------------------------------
  173. #if defined(powerc) || defined(__powerc)
  174. #pragma options align=reset
  175. #endif
  176.